package cn.donghuapian.vo;

import lombok.Data;

/**
 * @description:
 * @author: hzw
 * @time: 2024/9/24 15:24
 */
@Data
public class ResponseBody<T> {

    private String code;

    private String status;

    private String msg;

    private T data;

    public ResponseBody() {
    }

    public ResponseBody(String code, String status, String msg, T data) {
        this.code = code;
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public static <t> ResponseBody<t> success() {
        return new ResponseBody<>("0000", "000" , "调用成功", null);
    }

    public static <T> ResponseBody<T> success(T data) {
        return new ResponseBody<>("0000", "000" , "调用成功", data);
    }

    public static <T> ResponseBody<T> error(String msg) {
        return new ResponseBody<>("0001", "001" , msg, null);
    }
}
